<%@page import="dier.xuanke"%>
<%@page import="dier.Lesson"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

         <title>用户查询页面</title>

</head>
<style type="text/css">
   div {
    margin: 0 600px;
   }
   p {
    display: inline;
   }
   
   h2 {
    text-align: center;
    color: blue;
   }
   .xx{
    height: 1000px;
    width: 500;
    
   }
   
   .ys {
   Font-size:25px;
    color: green;
   }
 </style>
  <body>
 <div class="xx">
    <% 
    String Name=null;
    try
    {Name=request.getParameter("Name");}
    catch(Exception e){}
    String ClID=null;
    try
    {ClID=request.getParameter("ClID");}
    catch(Exception e){}
    out.print(Name);
    int tid=-1;
    int CPeople=-1;
    int CHpeople=-1;
  	try{
  		tid=Integer.parseInt(request.getParameter("tid")+"");
  	}
  	catch(Exception e) {
  		e.printStackTrace();
  	}
  	try{
  		CPeople=Integer.parseInt(request.getParameter("CPeople")+"");
  	}
  	catch(Exception e) {
  		e.printStackTrace();
  	}
  	try{
  		CHpeople=Integer.parseInt(request.getParameter("CHpeople")+"");
  	}
  	catch(Exception e) {
  		e.printStackTrace();
  	}
  	Lesson ls=new Lesson();
  	xuanke xk=new xuanke();
  	if(CHpeople==CPeople)
  	{
  	%>
  	<script type="text/javascript" >
			alert("该课程已经超过选课人数限制，选课失败。");         //弹出提示框输出错误信息
			window.location='Stuxuanke.jsp' ;     //跳转到选课界面
		</script>
  	
  	<%
  	}
  	else
  	{
  		xk.Stuxuanke(Name, tid);
  		%>
  	  	<script type="text/javascript" >
  				alert("选课成功！");         //弹出提示框输出错误信息
  				window.location='Stuxuanke.jsp' ;     //跳转到选课界面
  			</script>
  	  	
  	  	<%
  	}
   %>
 </div>
 </body>
 </html>
 